<template>
	<view>
		<view class="describe">根据您的个人信息，为您推荐一下院校</view>
		<view v-if="list.length > 0">
			<view class="nav" v-for="(item,index) in list" :key="index" @click="onclick(item)">
				<view class="left">
					<view class="box-left">
						<image :src="item.logo" mode=""></image>
					</view>
					<view class="details">
						<view class="title">{{item.name}}</view>
						<view class="speciality uni-ellipsis-1">地址：<text>{{item.city}}</text></view>
						<view class="speciality">概率：<text>{{((Number(item.gl)) * 100).toFixed(1)}}%</text></view>
						<view class="speciality three">
							<button class="btn" v-if="pay_prise == 39900" @click.stop='Govideo(item)'>
								<view class="box" style="margin-right: 40rpx;">视频：
									<image src="https://img.wilmer.com.cn/admin/2024/3-25/Group%20328.png" mode="">
									</image>
								</view>
							</button>
							<button open-type="contact" catchtap="contact" class="btn">
								<view class="box">客服：
									<image src="https://img.wilmer.com.cn/admin/2024/3-25/Group%20332.png" mode="">
									</image>
								</view>
							</button>
						</view>
					</view>
				</view>
				<image class="right" src="https://img.wilmer.com.cn/admin/2024/3-14/WechatIMG267.jpg" mode=""></image>
			</view>
		</view>
		<image v-if="list.length == 0" class="NoData" src="https://img.wilmer.com.cn/admin/2024/3-20/WechatIMG19.jpg"
			mode=""></image>
		<image @click="onReport()" class="Report" src="https://img.wilmer.com.cn/admin/2024/3-26/Group%20218.png"
			mode=""></image>
	</view>
</template>

<script>
	import {
		getReport
	} from '@/common/api/homePage.js'
	export default {
		data() {
			return {
				list: [], // 推荐院校
				orderNumber: "",
				pay_prise: "",
			}
		},
		onLoad(option) {
			this.orderNumber = option.orderNumber
			getReport(this.orderNumber).then(res => {
				this.pay_prise = res.data.data.pay_prise
				if (this.pay_prise <= 2990) { // 29.9 推荐5所学校
					if (res.data.data.schools.length < 5) {
						this.list = res.data.data.schools
					} else {
						this.list = res.data.data.schools.slice(0, 5)
					}
				} else if (this.pay_prise <= 9900 && this.pay_prise > 2990) { // 99 推荐10所学校
					if (res.data.data.schools.length < 10) {
						this.list = res.data.data.schools
					} else {
						this.list = res.data.data.schools.slice(0, 10)
					}
				} else if (this.pay_prise > 9900) { //399 推荐全部学校
					this.list = res.data.data.schools
				}
			})
		},
		methods: {
			onclick(item) {
				uni.navigateTo({
					url: `/pages/school/Institution-Details?id=${item.id}`
				})
			},
			onReport() {
				uni.navigateTo({
					url: `/pages/knowledge/AI_Report?orderNumber=${this.orderNumber}`
				})
			},
			Govideo(item) {
				uni.navigateTo({
					url: `/pages/knowledge/VideoList`
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		width: 100%;
		height: auto;
		background: #F7F7F8;
		overflow-x: hidden;
	}
</style>

<style lang="scss" scoped>
	::v-deep .btn {
		background-color: rgba(0, 0, 0, 0);
		margin: -10rpx -26rpx;
	}

	::v-deep .btn:after {
		border: none;
	}

	.uni-ellipsis-1 {
		display: -webkit-box;
		overflow: hidden;
		text-overflow: ellipsis;
		word-wrap: break-word;
		white-space: normal !important;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}

	.VideoStyle {
		width: 686rpx;
		height: 400rpx;
		margin: 30rpx auto 0;
		display: block;
	}

	.describe {
		margin-top: 24rpx;
		margin-left: 54rpx;
		font-family: Branding-BoldItalic;
		font-size: 28rpx;
		font-weight: 400;
		letter-spacing: 0.03em;
		color: #666666;
	}

	.nav {
		margin-top: 12rpx;
		width: 100vw;
		height: 224rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: #fff;

		.left {
			margin-left: 48rpx;
			display: flex;
			align-items: center;

			.box-left {
				width: 140rpx;
				height: 140rpx;
				border-radius: 50%;
				border: 1rpx solid #e6e1e1;
				line-height: 140rpx;
				overflow: hidden;
				position: relative;
				margin-right: 24rpx;

				image {
					width: 96rpx;
					height: 96rpx;
					position: absolute;
					top: 50%;
					left: 50%;
					transform: translate(-50%, -50%);
				}
			}

			.details {
				display: flex;
				flex-direction: column;

				.title {
					font-family: Branding-BoldItalic;
					font-size: 36rpx;
					font-weight: 500;
					letter-spacing: 0.03em;
				}

				.speciality {
					margin-top: 10rpx;
					font-family: Branding-BoldItalic;
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;

					text {
						font-family: Branding-BoldItalic;
						font-size: 28rpx;
						font-weight: 400;
						letter-spacing: 0.03em;
						color: #666666;
					}
				}

				.three {
					display: flex;
					align-items: center;

					.box {
						display: flex;
						align-items: center;

						font-family: Branding-BoldItalic;
						font-size: 24rpx;
						font-weight: 400;
						color: #999999;

						image {
							width: 40rpx;
							height: 36rpx;
							margin-left: 10rpx;
						}
					}
				}
			}
		}

		.right {
			width: 24rpx;
			height: 40rpx;
			margin-right: 68rpx;
		}
	}

	.Report {
		width: 120rpx;
		height: 120rpx;
		position: fixed;
		right: 26rpx;
		bottom: 60%;
	}

	.NoData {
		display: block;
		width: 400rpx;
		height: 318rpx;
		margin: 40rpx auto 0;
	}
</style>